<template>
	<view class="page">
		<view class="my_padding">
			<rich-text :nodes="info.content ? getHtml(info.content) : ''"  space="true" selectable="true"/>
		</view>
	</view>
</template>

<script>
	import htmlParser from '../../common/html-parser';
	export default {
		components: {

		},
		data() {
			return {
				id:0,
				article_id: 0,
				info: {
					content:''
				}, // 页面数据
				noData: '<p style="text-align:center;color:#666">详情加载中...</p>',
			}
		},
		onLoad(option) {
			// 初始化页面数据
			this.id = option.id
			this.article_id = option.id;
			this.loadData();
		},
		methods: {
			/**
			 * 请求页面数据
			 */
			getHtml(content){
				return htmlParser(content);
			},
			loadData:function(){
				//获取基础参数
				// uni.showLoading({
				// 	title:"数据加载中",
				// 	mask:true
				// })
				console.log(11111)
				let timestamp = this.helper.now();
				let sign = this.helper.setSign(['id='+this.article_id,'timestamp='+timestamp]);
				this.helper.req({
					api:"getArticle",
					timestamp:timestamp,
					data:{id:this.article_id},
					header:{sign:sign},
					method:'GET',
				}).then(res=>{
					this.info = res.data.data.articleInfo;
					uni.setNavigationBarTitle({
						title: this.info.title
					});
					uni.hideLoading();
				})
			}
		}
	}
</script>

<style lang="scss">
.my_padding {
		color: #56595d;
		background-color: #ddeafd;
		padding: 6vw 4vw;
		
		rich-text{
			color:#fff;
		}
	}
	
</style>
